package com.heima;

import java.sql.SQLOutput;
import java.util.Random;

public class Homework05 {
    public static void main(String[] args) {
        System.out.println(getYZM());
    }

    public static StringBuilder getYZM() {
        //将a-z、A-Z和0-9存到一个StringBuilder中
        StringBuilder b01 = new StringBuilder();
        for (char i = 'a'; i <= 'z'; i++) {
            b01.append(i);
        }
        for (char j = 'A'; j <= 'Z'; j++) {
            b01.append(j);
        }
        for (char K = '0'; K <= '9'; K++) {
            b01.append(K);
        }
        //随机数抽取b01的索引，共抽取四次
        int index;
        StringBuilder yzm = new StringBuilder();
        Random r = new Random();
        for (int m = 0; m < 4; m++) {
            index = r.nextInt(0, 62);
            yzm.append(b01.charAt(index));
        }
        return yzm;
    }
}
